home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / ftn / sync.z / sync
Encoding:
Text File  |  1998-10-30  |  15.6 KB  |  265 lines

  1.  
  2.  
  3.  
  4. SSSSYYYYNNNNCCCC((((3333FFFF))))                                                              SSSSYYYYNNNNCCCC((((3333FFFF))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      sync: synchronize, fetch_and_add, fetch_and_sub, fetch_and_or,
  10.      fetch_and_and, fetch_and_xor, fetch_and_nand, add_and_fetch,
  11.      sub_and_fetch, or_and_fetch, and_and_fetch, xor_and_fetch,
  12.      nand_and_fetch, lock_test_and_set, lock_release - FORTRAN synchronization
  13.      primitives for multiprocessing
  14.  
  15. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  16.      iiiinnnntttteeeeggggeeeerrrr****4444 iiii4444,,,, jjjj4444,,,, kkkk4444,,,, jjjjjjjj4444
  17.      iiiinnnntttteeeeggggeeeerrrr****8888 iiii8888,,,, jjjj8888,,,, kkkk8888,,,, jjjjjjjj8888
  18.      llllooooggggiiiiccccaaaallll****4444 llll4444
  19.      llllooooggggiiiiccccaaaallll****8888 llll8888
  20.  
  21.      ccccaaaallllllll ssssyyyynnnncccchhhhrrrroooonnnniiiizzzzeeee
  22.  
  23.      iiii4444 ==== ffffeeeettttcccchhhh____aaaannnndddd____aaaadddddddd ((((jjjj4444,,,, kkkk4444))))
  24.      iiii8888 ==== ffffeeeettttcccchhhh____aaaannnndddd____aaaadddddddd ((((jjjj8888,,,, kkkk8888))))
  25.  
  26.      iiii4444 ==== ffffeeeettttcccchhhh____aaaannnndddd____ssssuuuubbbb ((((jjjj4444,,,, kkkk4444))))
  27.      iiii8888 ==== ffffeeeettttcccchhhh____aaaannnndddd____ssssuuuubbbb ((((jjjj8888,,,, kkkk8888))))
  28.  
  29.      iiii4444 ==== ffffeeeettttcccchhhh____aaaannnndddd____oooorrrr ((((jjjj4444,,,, kkkk4444))))
  30.      iiii8888 ==== ffffeeeettttcccchhhh____aaaannnndddd____oooorrrr ((((jjjj8888,,,, kkkk8888))))
  31.  
  32.      iiii4444 ==== ffffeeeettttcccchhhh____aaaannnndddd____aaaannnndddd ((((jjjj4444,,,, kkkk4444))))
  33.      iiii8888 ==== ffffeeeettttcccchhhh____aaaannnndddd____aaaannnndddd ((((jjjj8888,,,, kkkk8888))))
  34.  
  35.      iiii4444 ==== ffffeeeettttcccchhhh____aaaannnndddd____xxxxoooorrrr ((((jjjj4444,,,, kkkk4444))))
  36.      iiii8888 ==== ffffeeeettttcccchhhh____aaaannnndddd____xxxxoooorrrr ((((jjjj8888,,,, kkkk8888))))
  37.  
  38.      iiii4444 ==== ffffeeeettttcccchhhh____aaaannnndddd____nnnnaaaannnndddd ((((jjjj4444,,,, kkkk4444))))
  39.      iiii8888 ==== ffffeeeettttcccchhhh____aaaannnndddd____nnnnaaaannnndddd ((((jjjj8888,,,, kkkk8888))))
  40.  
  41.  
  42.      iiii4444 ==== aaaadddddddd____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj4444,,,, kkkk4444))))
  43.      iiii8888 ==== aaaadddddddd____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj8888,,,, kkkk8888))))
  44.  
  45.      iiii4444 ==== ssssuuuubbbb____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj4444,,,, kkkk4444))))
  46.      iiii8888 ==== ssssuuuubbbb____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj8888,,,, kkkk8888))))
  47.  
  48.      iiii4444 ==== oooorrrr____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj4444,,,, kkkk4444))))
  49.      iiii8888 ==== oooorrrr____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj8888,,,, kkkk8888))))
  50.  
  51.      iiii4444 ==== aaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj4444,,,, kkkk4444))))
  52.      iiii8888 ==== aaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj8888,,,, kkkk8888))))
  53.  
  54.      iiii4444 ==== xxxxoooorrrr____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj4444,,,, kkkk4444))))
  55.      iiii8888 ==== xxxxoooorrrr____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj8888,,,, kkkk8888))))
  56.  
  57.      iiii4444 ==== nnnnaaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj4444,,,, kkkk4444))))
  58.      iiii8888 ==== nnnnaaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh ((((jjjj8888,,,, kkkk8888))))
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSYYYYNNNNCCCC((((3333FFFF))))                                                              SSSSYYYYNNNNCCCC((((3333FFFF))))
  71.  
  72.  
  73.  
  74.      llll4444 ==== ccccoooommmmppppaaaarrrreeee____aaaannnndddd____sssswwwwaaaapppp(((( jjjj4444,,,, kkkk4444,,,, jjjjjjjj4444))))
  75.      llll8888 ==== ccccoooommmmppppaaaarrrreeee____aaaannnndddd____sssswwwwaaaapppp(((( jjjj8888,,,, kkkk8888,,,, jjjjjjjj8888))))
  76.  
  77.      iiii4444 ==== lllloooocccckkkk____tttteeeesssstttt____aaaannnndddd____sssseeeetttt ((((jjjj4444 ,,,, kkkk4444))))
  78.      iiii8888 ==== lllloooocccckkkk____tttteeeesssstttt____aaaannnndddd____sssseeeetttt ((((jjjj8888 ,,,, kkkk8888))))
  79.  
  80.      ccccaaaallllllll lllloooocccckkkk____rrrreeeelllleeeeaaaasssseeee((((iiii4444))))
  81.      ccccaaaallllllll lllloooocccckkkk____rrrreeeelllleeeeaaaasssseeee((((iiii8888))))
  82.  
  83.  
  84. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  85.      The intrinsics described here provide a variety of primitive
  86.      synchronization operations. Besides performing the particular
  87.      synchronization operation, each of these intrinsics has two key
  88.      properties:
  89.  
  90.          The function performed is guaranteed to be atomic (typically achieved
  91.          by implementing the operation using a sequence of load-linked/store-
  92.          conditional instructions in a loop).
  93.  
  94.          Associated with each intrinsic are certain _m_e_m_o_r_y _b_a_r_r_i_e_r properties
  95.          that restrict the movement of memory references to _v_i_s_i_b_l_e _d_a_t_a
  96.          across the intrinsic operation (by either the compiler or the
  97.          processor).
  98.  
  99.          A visible memory reference is a reference to a data object
  100.          potentially accessible by another thread executing in the same shared
  101.          address space. A visible data object may be one of the following:
  102.  
  103.              C/C++ global data
  104.  
  105.              Fortran COMMON data
  106.  
  107.              data declared _e_x_t_e_r_n
  108.  
  109.              volatile data
  110.  
  111.              static data (either file-scope or function-scope)
  112.  
  113.              data accessible via function parameters
  114.  
  115.              automatic data (local-scope) that has had its address taken and
  116.              assigned to some object which is visible (recursively).
  117.  
  118.  
  119.          The memory barrier semantics of an intrinsic may be one of the
  120.          following three types:
  121.  
  122.              aaaaccccqqqquuuuiiiirrrreeee bbbbaaaarrrrrrrriiiieeeerrrr
  123.  
  124.              Disallows the movement of memory references to visible data from
  125.              after the intrinsic (in program order) to before the intrinsic
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSYYYYNNNNCCCC((((3333FFFF))))                                                              SSSSYYYYNNNNCCCC((((3333FFFF))))
  137.  
  138.  
  139.  
  140.              (this behavior is desirable at lock-acquire operations, hence the
  141.              name).
  142.  
  143.  
  144.              rrrreeeelllleeeeaaaasssseeee bbbbaaaarrrrrrrriiiieeeerrrr
  145.  
  146.              Disallows the movement of memory references to visible data from
  147.              before the intrinsic (in program order) to after the intrinsic
  148.              (this behavior is desirable at lock-release operations, hence the
  149.              name).
  150.  
  151.              ffffuuuullllllll bbbbaaaarrrrrrrriiiieeeerrrr
  152.  
  153.              Disallows the movement of memory references to visible data past
  154.              the intrinsic (in either direction), and is thus both an acquire
  155.              and a release barrier. A barrier only restricts the movement of
  156.              memory references to visible data across the intrinsic operation:
  157.              between synchronization operations (or in their absence), memory
  158.              references to visible data may be freely reordered subject to the
  159.              usual data-dependence constraints.
  160.  
  161.      CCCCaaaauuuuttttiiiioooonnnn:::: Conditional execution of a synchronization intrinsic (such as
  162.      within a _i_f or a _w_h_i_l_e statement) does not prevent the movement of memory
  163.      references to visible data past the overall _i_f or _w_h_i_l_e construct.
  164.  
  165.  
  166.      AAAAttttoooommmmiiiicccc ffffeeeettttcccchhhh----aaaannnndddd----oooopppp OOOOppppeeeerrrraaaattttiiiioooonnnnssss
  167.  
  168.      ffffeeeettttcccchhhh____aaaannnndddd____aaaadddddddd,,,, ffffeeeettttcccchhhh____aaaannnndddd____ssssuuuubbbb,,,, ffffeeeettttcccchhhh____aaaannnndddd____oooorrrr,,,, ffffeeeettttcccchhhh____aaaannnndddd____aaaannnndddd,,,, ffffeeeettttcccchhhh____aaaannnndddd____xxxxoooorrrr
  169.      and ffffeeeettttcccchhhh____aaaannnndddd____nnnnaaaannnndddd atomically perform the specified operation with the
  170.      second operand on the first, and return the old value of the first
  171.      operand. These intrinsics have full barrier memory semantics. IIIInnnntttteeeeggggeeeerrrr****4444
  172.      and IIIInnnntttteeeeggggeeeerrrr****8888 specific versions of these intrinsics carry the ____33332222 and ____66664444
  173.      suffix on the intrinsic name.
  174.  
  175.  
  176.  
  177.      AAAAttttoooommmmiiiicccc oooopppp----aaaannnndddd----ffffeeeettttcccchhhh OOOOppppeeeerrrraaaattttiiiioooonnnnssss
  178.  
  179.      aaaadddddddd____aaaannnndddd____ffffeeeettttcccchhhh,,,, ssssuuuubbbb____aaaannnndddd____ffffeeeettttcccchhhh,,,, oooorrrr____aaaannnndddd____ffffeeeettttcccchhhh,,,, aaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh,,,, xxxxoooorrrr____aaaannnndddd____ffffeeeettttcccchhhh
  180.      and nnnnaaaannnndddd____aaaannnndddd____ffffeeeettttcccchhhh atomically perform the specified operation with the
  181.      second operand on the first, and return the new value of the first
  182.      operand. These intrinics have full barrier memory semantics. IIIInnnntttteeeeggggeeeerrrr****4444
  183.      and IIIInnnntttteeeeggggeeeerrrr****8888 specific versions of these intrinsics carry the ____33332222 and ____66664444
  184.      suffix on the intrinsic name.
  185.  
  186.  
  187.      AAAAttttoooommmmiiiicccc ccccoooommmmppppaaaarrrreeee----aaaannnndddd----sssswwwwaaaapppp OOOOppppeeeerrrraaaattttiiiioooonnnn
  188.  
  189.      The ccccoooommmmppppaaaarrrreeee____aaaannnndddd____sssswwwwaaaapppp intrinsics atomically compare the value of the first
  190.      operand to the value of the second. If they are equal, the intrinsics
  191.      store the value of the third operand into the first operand and return
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SSSSYYYYNNNNCCCC((((3333FFFF))))                                                              SSSSYYYYNNNNCCCC((((3333FFFF))))
  203.  
  204.  
  205.  
  206.      TTTTRRRRUUUUEEEE.... Otherwise, they return FFFFAAAALLLLSSSSEEEE.... These intrinics have full barrier
  207.      memory semantics. IIIInnnntttteeeeggggeeeerrrr****4444 and IIIInnnntttteeeeggggeeeerrrr****8888 specific versions of these
  208.      intrinsics carry the ____33332222 and ____66664444 suffix on the intrinsic name.
  209.  
  210.  
  211.  
  212.      AAAAttttoooommmmiiiicccc ssssyyyynnnncccchhhhrrrroooonnnniiiizzzzeeee OOOOppppeeeerrrraaaattttiiiioooonnnn
  213.  
  214.      The ssssyyyynnnncccchhhhrrrroooonnnniiiizzzzeeee intrinsic has full barrier memory semantics.
  215.  
  216.  
  217.      AAAAttttoooommmmiiiicccc lllloooocccckkkk----tttteeeesssstttt----aaaannnndddd----sssseeeetttt OOOOppppeeeerrrraaaattttiiiioooonnnn
  218.  
  219.      The lllloooocccckkkk____tttteeeesssstttt____aaaannnndddd____sssseeeetttt intrinsics atomically store the value of the second
  220.      operand into the first and return the old value of the first operand.
  221.      They have acquire barrier memory semantics.  IIIInnnntttteeeeggggeeeerrrr****4444 and IIIInnnntttteeeeggggeeeerrrr****8888
  222.      specific versions of these intrinsics carry the ____33332222 and ____66664444 suffix on the
  223.      intrinsic name.
  224.  
  225.  
  226.      AAAAttttoooommmmiiiicccc lllloooocccckkkk____rrrreeeelllleeeeaaaasssseeee OOOOppppeeeerrrraaaattttiiiioooonnnn
  227.  
  228.      The lllloooocccckkkk____rrrreeeelllleeeeaaaasssseeee intrinsics set the first operand to zero. They have
  229.      release barrier memory semantics.  IIIInnnntttteeeeggggeeeerrrr****4444 and IIIInnnntttteeeeggggeeeerrrr****8888 specific
  230.      versions of these intrinsics carry the ____33332222 and ____66664444 suffix on the
  231.      intrinsic name.
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.